package com.kaifamiao.base.exam20210925;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author lucien-ma
 * @date 2021/9/25
 * @apiNote
 */
public class Demo03 {
    public static void print(Map<String, Object> map){
        Set<Map.Entry<String, Object>> entries = map.entrySet();
        for (Map.Entry<String, Object> entry : entries) {
            System.out.println(entry.getKey() + "-->" + entry.getValue());
        }
    }

    public static void main(String[] args){
        Map<String, Object> map = new LinkedHashMap<>();
        map.put("name", "路飞");
        map.put("age", 20);
        map.put("title", "海贼王");
        map.put("gf", new GirlFriend("汉库克", 18, '女'));

        print(map);
    }
}

@Data
@AllArgsConstructor
@NoArgsConstructor
class GirlFriend{
    private String name;
    private Integer age;
    private String title;
    private Character gender;

    public GirlFriend(String name, Integer age, Character gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }
}